package com.JavaNet.chapter5_url;

import java.io.*;
import java.net.*;

public class ContentGetter {

    public static void main(String[] args) {


        // Open the URL for reading
        try {
            String path = "file:///D:/Electronic-documents%E7%94%B5%E5%AD%90%E6%96%87%E7%8C%AE/Java%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/%E3%80%8AJava%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B(%E7%AC%AC4%E7%89%88)%E3%80%8B.((%E7%BE%8E)Elliotte%20Rusty%20Harold).[PDF]@ckook.pdf";
            URL u = new URL(path);
            Object o = u.getContent();  //获取一个流
            System.out.println("I got a " + o.getClass().getName());
        } catch (MalformedURLException ex) {
            System.err.println("ERROR  this path  is not a parseable URL");
        } catch (IOException ex) {
            System.err.println(ex);
        }

    }
}
